package io.renren.modules.welderunnormal.service.impl;

import io.renren.modules.tbposition.service.PosWebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.welderunnormal.dao.WelderunnormalDao;
import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import io.renren.modules.welderunnormal.service.WelderunnormalService;


@Service("welderunnormalService")
public class WelderunnormalServiceImpl extends ServiceImpl<WelderunnormalDao, WelderunnormalEntity> implements WelderunnormalService {

    @Autowired
    WelderunnormalDao welderunnormalDao;
    @Autowired
    PosWebSocketService posWebSocketService;
//    WebSocketServer webSocketServer;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<WelderunnormalEntity> page = this.page(
                new Query<WelderunnormalEntity>().getPage(params),
                new QueryWrapper<WelderunnormalEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<WelderunnormalEntity> getInfo(String groupName, String welderName, String startTime, String endTime) {
        posWebSocketService.sendMessage(welderunnormalDao.getInfo(groupName,welderName,startTime,endTime).toString());
        return welderunnormalDao.getInfo(groupName,welderName,startTime,endTime);
    }

}